
/*
 * Copyright 2002-2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 *版权所有2002-2014原作者。
 *
 *根据Apache许可证2.0版（“许可证”）许可；
 *除非符合许可证的规定，否则您不得使用此文件。
 *您可以在以下网址获取许可证副本
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 *除非适用法律要求或书面同意，否则软件
 *根据许可证分发是在“按原样”的基础上分发的，
 *无任何明示或暗示的保证或条件。
 *有关管理权限的特定语言，请参阅许可证
 *许可证下的限制。
 */

package org.springframework.context;

import org.springframework.beans.factory.HierarchicalBeanFactory;
import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.core.env.EnvironmentCapable;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.lang.Nullable;

/**
 * Central interface to provide configuration for an application.
 * This is read-only while the application is running, but may be
 * reloaded if the implementation supports this.
 *
 * <p>An ApplicationContext provides:
 * <ul>
 * <li>Bean factory methods for accessing application components.
 * Inherited from {@link org.springframework.beans.factory.ListableBeanFactory}.
 * <li>The ability to load file resources in a generic fashion.
 * Inherited from the {@link org.springframework.core.io.ResourceLoader} interface.
 * <li>The ability to publish events to registered listeners.
 * Inherited from the {@link ApplicationEventPublisher} interface.
 * <li>The ability to resolve messages, supporting internationalization.
 * Inherited from the {@link MessageSource} interface.
 * <li>Inheritance from a parent context. Definitions in a descendant context
 * will always take priority. This means, for example, that a single parent
 * context can be used by an entire web application, while each servlet has
 * its own child context that is independent of that of any other servlet.
 * </ul>
 *
 * <p>In addition to standard {@link org.springframework.beans.factory.BeanFactory}
 * lifecycle capabilities, ApplicationContext implementations detect and invoke
 * {@link ApplicationContextAware} beans as well as {@link ResourceLoaderAware},
 * {@link ApplicationEventPublisherAware} and {@link MessageSourceAware} beans.
 *
 * @author Rod Johnson
 * @author Juergen Hoeller
 * @see ConfigurableApplicationContext
 * @see org.springframework.beans.factory.BeanFactory
 * @see org.springframework.core.io.ResourceLoader
 */
/**
 *为应用程序提供配置的中央接口。
 *当应用程序正在运行时，这是只读的，但可能是
 *如果实现支持，则重新加载。
 *
 *<p>ApplicationContext提供：
 *＜ul＞
 *＜li＞用于访问应用程序组件的Bean工厂方法。
 *继承自{@linkorg.springframework.beans.factory.ListableBeanFactory}。
 *＜li＞以通用方式加载文件资源的能力。
 *继承自{@link org.springframework.core.io.ResourceLoader}接口。
 *<li>将事件发布到已注册侦听器的功能。
 *从｛@link ApplicationEventPublisher｝接口继承。
 *＜li＞解析消息的能力，支持国际化。
 *从｛@link MessageSource｝接口继承。
 *<li>从父上下文继承。子体上下文中的定义
 *将始终优先考虑。这意味着，例如，单亲
 *整个web应用程序都可以使用上下文，而每个servlet都有
 *它自己的子上下文独立于任何其他servlet的子上下文。
 *</ul>
 *
 *<p>除了标准的{@linkorg.springframework.beans.factory.BeanFactory｝
 *生命周期功能，ApplicationContext实现检测和调用
 *{@link ApplicationContextAware}bean以及{@link ResourceLoaderAware}，
 *｛@link ApplicationEventPublisherWare｝和｛@linkMessageSourceAware｝bean。
 *
 *@作者罗德·约翰逊
 *@作者Juergen Hoeller
 *@请参阅可配置的应用程序上下文
 *@参见org.springframework.beans.factory.BeanFactory
 *@参见org.springframework.core.io.ResourceLoader
 */
public interface ApplicationContext extends EnvironmentCapable, ListableBeanFactory, HierarchicalBeanFactory,
		MessageSource, ApplicationEventPublisher, ResourcePatternResolver {

	/**
	 * Return the unique id of this application context.
	 * @return the unique id of the context, or {@code null} if none
	 */
	/**
	 *返回此应用程序上下文的唯一id。
	 *@返回上下文的唯一id，如果没有，则返回｛@code null｝
	 */
	@Nullable
	String getId();

	/**
	 * Return a name for the deployed application that this context belongs to.
	 * @return a name for the deployed application, or the empty String by default
	 */
	/**
	 *返回此上下文所属的已部署应用程序的名称。
	 *@返回已部署应用程序的名称，或默认为空的String
	 */
	String getApplicationName();

	/**
	 * Return a friendly name for this context.
	 * @return a display name for this context (never {@code null})
	 */
	/**
	 *返回此上下文的友好名称。
	 *@返回此上下文的显示名称（从不｛@code null｝）
	 */
	String getDisplayName();

	/**
	 * Return the timestamp when this context was first loaded.
	 * @return the timestamp (ms) when this context was first loaded
	 */
	/**
	 *返回首次加载此上下文时的时间戳。
	 *@返回首次加载此上下文时的时间戳（ms）
	 */
	long getStartupDate();

	/**
	 * Return the parent context, or {@code null} if there is no parent
	 * and this is the root of the context hierarchy.
	 * @return the parent context, or {@code null} if there is no parent
	 */
	/**
	 *返回父上下文，如果没有父上下文，则返回｛@code null｝
	 *这是上下文层次结构的根。
	 *@返回父上下文，或者｛@code null｝（如果没有父上下文）
	 */
	@Nullable
	ApplicationContext getParent();

	/**
	 * Expose AutowireCapableBeanFactory functionality for this context.
	 * <p>This is not typically used by application code, except for the purpose of
	 * initializing bean instances that live outside the application context,
	 * applying the Spring bean lifecycle (fully or partly) to them.
	 * <p>Alternatively, the internal BeanFactory exposed by the
	 * {@link ConfigurableApplicationContext} interface offers access to the
	 * {@link AutowireCapableBeanFactory} interface too. The present method mainly
	 * serves as a convenient, specific facility on the ApplicationContext interface.
	 * <p><b>NOTE: As of 4.2, this method will consistently throw IllegalStateException
	 * after the application context has been closed.</b> In current Spring Framework
	 * versions, only refreshable application contexts behave that way; as of 4.2,
	 * all application context implementations will be required to comply.
	 * @return the AutowireCapableBeanFactory for this context
	 * @throws IllegalStateException if the context does not support the
	 * {@link AutowireCapableBeanFactory} interface, or does not hold an
	 * autowire-capable bean factory yet (e.g. if {@code refresh()} has
	 * never been called), or if the context has been closed already
	 * @see ConfigurableApplicationContext#refresh()
	 * @see ConfigurableApplicationContext#getBeanFactory()
	 */
	/**
	 *公开此上下文的AutowireCapableBeanFactory功能。
	 *<p>除了用于
	 *初始化位于应用程序上下文之外的bean实例，
	 *将Springbean生命周期（全部或部分）应用于它们。
	 *<p>或者
	 *｛@link ConfigurationApplicationContext｝接口提供对
	 *｛@link AutowireCapableBeanFactory｝接口。目前的方法主要是
	 *用作ApplicationContext接口上的一个方便、特定的工具。
	 *<p><b>注意：从4.2开始，此方法将持续抛出IllegalStateException
	 *在关闭应用程序上下文之后</b> 在当前的Spring框架中
	 *版本，只有可刷新的应用程序上下文才会有这种行为；截至4.2，
	 *所有应用程序上下文实现都将被要求遵守。
	 *@返回此上下文的AutowireCapableBeanFactory
	 *如果上下文不支持
	 *｛@link AutowireCapableBeanFactory｝接口，或不包含
	 *支持autowire的bean工厂（例如，如果{@code refresh（）}已经
	 *从未被调用），或者如果上下文已经关闭
	 *@请参阅ConfigurationApplicationContext#refresh（）
	 *@请参阅可配置应用程序上下文#getBeanFactory（）
	 */
	AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException;

}
